feat(datagrid): native dropdown picker for ENUM and SET cells (#1283)#1297
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PluginColumnInfo.allowedValuesinstead of being parsed downstream from the type string.=and!=operators on enum columns.Behavior
Returnon focused cellMatches Apple HIG: chevron = explicit "pick from list", cell body = "type/correct" affordance, both available for different intents.
Edge cases handled
NULLsentinel at top, separated.exclamationmark.triangle.filland localized tooltip.Driver scope
COLUMN_TYPEENUM(...)/SET(...)parsed in driverpg_type+pg_enumjoined infetchColumnssystem.columns.typeEnum8('v'=1, ...)parsed in driver (handlesNullable(...)/LowCardinality(...))duckdb_types() WHERE type_category = 'ENUM'options.validator.$jsonSchema.properties.<col>.enumCHECK (col IN (...))DDL parser retained as fallbackPostgreSQL was the most visible gap before —
pg_enumdata existed but never reached the picker. SQLite/MSSQL/Oracle CHECK-constraint expansion is intentionally out of scope.Architecture changes
PluginColumnInfogrows optionalallowedValues: [String]?(Codable shape change, no PluginKit ABI bump — JSON encoded, missing key decodes to nil).MainContentCoordinator.fetchEnumValuesshrinks from per-engine orchestration tocol.allowedValueslookup + SQLite CHECK fallback.ColumnType.parseEnumValues/parseClickHouseEnumValuesdeleted; moved toEnumValueParserinTableProPluginKitso drivers parse at fetch time.FieldEditorResolvermoved fromViews/RightSidebar/FieldEditors/toViews/Shared/FieldEditors/.DataGridCoordinator.rebuildKindSetsnow trustscolumnEnumValuesinstead ofct.isEnumType(the classifier only sees the raw type name and can't recognize PG UDTs).EnumPopoverContentView(SwiftUI) deleted, replaced byEnumMenuPicker(AppKit NSMenu).Plugin re-release
No PluginKit ABI bump needed. DuckDB and MongoDB plugins should get patch tags (
plugin-duckdb-v1.0.10,plugin-mongodb-v1.0.10) after merge to main, since their code (not just data shape) changed.Test plan
CREATE TYPE foo AS ENUM(...)column shows picker (was broken before this PR)Enum8('a'=1, 'b'=2)andNullable(Enum8(...))both workCREATE TYPE foo AS ENUM(...)column shows picker$jsonSchema.properties.col.enumshows pickerCHECK (col IN ('a','b'))regression check — still works via fallbackNULLsentinel at top of menu=and!=on enum column shows picker instead of text inputswiftlint lint --strictpassesxcodebuild testpasses